package com.seadragon.apps.doctorcard.repository;

import java.util.List;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import com.seadragon.apps.doctorcard.model.Contact;

public interface ContactRepository extends JpaRepository<Contact, Long> {
	Contact findByMobile(String mobile);
	
	Contact findByEmailIgnoreCase(String email);
	
	Contact findByDoctorCardIdIgnoreCase(String doctorCardId);
	
	Contact findByToken(String token);
	
	Contact findByDoctorCardIdAndMobileIgnoreCase(String doctorCardId, String mobile);
	
	Contact findByDoctorCardIdAndEmailIgnoreCase(String doctorCardId, String email);
	
	Contact findByMobileAndEmailIgnoreCase(String mobile, String email);
	
	Contact findByDoctorCardIdAndMobileAndEmailIgnoreCase(String doctorCardId, String mobile, String email);

	@Query("select c.uuid from Contact c")
	List<String> findAllUuid();
	
	Contact findByUuid(String uuid);
	
	List<Contact> findByNameLikeIgnoreCase(String name);
	
	List<Contact> findByEnglishNameLikeIgnoreCase(String englishName);
	
	List<Contact> findByNameContainingIgnoreCaseOrEnglishNameContainingIgnoreCase(String name, String englishName);	
	
	List<Contact> findByDoctorCardIdOrMobileOrEmailIgnoreCase(String doctorCardId, String mobile, String email);
	
	List<Contact> findByDoctorCardIdOrMobileOrEmailOrNameOrEnglishNameIgnoreCase(String doctorCardId, String mobile, String email, String name, String englishName);
	
}
